using System;
using System.Collections.Generic;
using System.Text;
using Blazing.BusinessObjects.Cms;

using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;


namespace BusinessObjectTests
{
    [TestClass]
    public class ThemeTests : NHibernateInMemoryTestFixtureBase
    {
        private void CheckValues(Theme obj, Theme newObj)
        {
            Assert.AreEqual(obj.ID, newObj.ID);
            Assert.AreEqual(obj.Name, newObj.Name);
            Assert.AreEqual(obj.Description, newObj.Description);
            Assert.AreEqual(obj.Path, newObj.Path);
            Assert.AreEqual(obj.RowStamp, newObj.RowStamp);
        }

        [TestMethod]
        public void CreateTheme()
        {
            Theme obj = BusinessObjectFactory.CreateAndFillTheme();
            obj.Masterpage = BusinessObjectFactory.CreateAndFillMasterPage();
            obj.Masterpage.Site = BusinessObjectFactory.CreateAndFillSite();
            obj.Masterpage.Site.Save();
            obj.Masterpage.Save();
            obj.Save();

            Theme obj2 = Theme.Load(obj.ID);
            Assert.IsNotNull(obj2);

            CheckValues(obj, obj2);

            obj.Delete();
            obj.Save();
        }
    }
}
